package com.wbihua.grpc.demo.service.impl;

import cn.hutool.core.text.CharSequenceUtil;
import com.wbihua.grpc.demo.entity.User;
import com.wbihua.grpc.demo.mapper.UserMapper;
import com.wbihua.grpc.demo.service.HelloService;
import com.wbihua.grpc.demo.spring.annotation.GrpcService;
import org.springframework.beans.factory.annotation.Autowired;

@GrpcService
public class HelloServiceImpl implements HelloService {

    @Autowired(required = false)
    private UserMapper userMapper;

    @Override
    public String echo(String name) {
        User user = userMapper.getUserByName(name);
        return CharSequenceUtil.format("hello {}", user);
    }
}
